#encoding: UTF-8
<html>
<head>
	<link rel="stylesheet" href="/css/category.css" />
	<script type="application/javascript">
		function checkform() {
			if (document.f.category.value == '') {
				alert("Bạn phải nhập category name");
				return false;
			}
			return true;
		}
	</script>
</head>

<body>
	<div id="top-nav">
		<ul>
			<li><a href="/index">Trang chủ</a></li>
			<li><a href="/category?database=$database">Danh mục</a></li>
		</ul>
	</div>
	<div class="clear"></div>
	<div id="wrapper">
		<div class="form">
			<form name="f" action="$formaction" method="post" onsubmit="return checkform();">
				<table width="100%">
					<tr>
						<td width="150">Name of category </td>
						<td><input type="text" name="category" value="$data.catName" size="35"/></td>
					</tr>
					<tr>
						<td>Root</td>
						<td><select name="root">
								<option value="0">--------------------------------</option>
								#for $cat in $categories
								<option value="$cat[0]">$cat[1]</option>
								#end for
							</select>
						</td>
					</tr>
					<tr>
						#set $submitLabel = "submit"
						#if $data.formsaved
							#set $submitLabel = "save"
						#end if
						<td colspan="2" align="center"><input type="submit" value="$submitLabel" /></td>
					</tr>
				</table>
			</form>
		</div>
		<hr />
		<table class="center" width="500" border="1" cellpadding="5" cellspacing="2">
			<tr>
				<td>id</td>
				<td>Cat Name</td>
				<td>Parent</td>
				<td>&nbsp;</td>
			</tr>
			#for $cat in $categories
			<tr>
				<td>$cat[0]</td>
				<td><a href="/category?do=edit&cid=$cat[0]">$cat[1]</a></td>
				<td>$cat[2]</td>
				<td align="center"><a href="/category/delete?cid=$cat[0]"><img src="/images/ic_delete.png" width="20"/></a></td>
			</tr>
			#end for
		</table>
	</div>
</body>
	
</html>